package generic;

public class Test2 {
    public static void main(String[] args) {
        StudentInfo<Integer> s1 = new StudentInfo<>(1, 100);
        StudentInfo<Double> s2 = new StudentInfo<>(2, 99.9);
        StudentInfo<String> s3 = new StudentInfo<>(31, "优秀");
        StudentInfo<String> s4 = new StudentInfo<>(11, "B");
        StudentInfo<?>[] studentInfos = new StudentInfo[4];
        studentInfos[0] = s1;
        studentInfos[1] = s2;
        studentInfos[2] = s3;
        studentInfos[3] = s4;

        for (StudentInfo<?> studentInfo : studentInfos) {
            System.out.println(studentInfo.toString());
        }
    }
}

class StudentInfo<T> {
    private int id;
    private T score;

    public StudentInfo(int id, T score) {
        this.id = id;
        this.score = score;
    }

    public StudentInfo() {
    }

    @Override
    public String toString() {
        return "StudentInfo{" +
                "id=" + id +
                ", score=" + score +
                '}';
    }
}
